package edu.tum.cs.i1.pse;

import java.util.Iterator;

public class MilitaryEncryption extends Encryption {
	
	public MilitaryEncryption() {
		currentCipher = new Blowfish(); // Blowfish: about 5 stages hacked out of 16
	}

	@Override
	public String encryptWord(String w, byte k) {
		StringBuffer result = new StringBuffer();
		Iterator<String> wIterator = new StringWordsIterator(w);
		
		while(wIterator.hasNext()) {
			result.append(currentCipher.encryptWord(wIterator.next(), k));
			result.append(" ");
		}
		
		return result.toString();
	}

	@Override
	public String decryptWord(String w, byte k) {
		StringBuffer result = new StringBuffer();
		Iterator<String> wIterator = new StringWordsIterator(w);
		//TODO LOL
		while(wIterator.hasNext()) {
			result.append(currentCipher.decryptWord(wIterator.next(), k));
			result.append(" ");
		}
		
		return result.toString();
	}

}
